from flask import Blueprint
from flask_jwt_extended import get_jwt_identity

from app.services.solution_servie import get_solution_list_by_author
from app.utils.response import success, error

solution_bp = Blueprint('solutions', __name__, url_prefix='/solutions')



"""
查看题解列表
"""
@solution_bp.route('/problems/<int:id>/solution', methods=['GET'])
def get_solution_list(id):
    author_id = get_jwt_identity()
    solutions = get_solution_list_by_author(author_id)
    if solutions:
        return success(solutions)
    return error(msg="题解列表为空")
